'use client';
import { useNavigate } from "react-router-dom";
import styles from './Left.module.css';
import ChatHistory from "./chat-history";
import { useSearchParams } from "react-router-dom";
//逻辑已处理完毕
export default function Left() {
  const navigate = useNavigate();
  const [SearchParams] = useSearchParams();
  const email = SearchParams.get('email');
  const handleNavigate = () => {
    navigate(`/HeroSection/select?email=${email}`);
  };

  return (
    <div className={styles.left}>
      <div className={styles.leftTitle}>对话管理</div>
      <button 
        className={styles.leftTop} 
        onClick={handleNavigate}
      >
        <span className={styles.iconPlus}></span>
        新增聊天
      </button>
      <ChatHistory/>
    </div>
  );
}